<?php

namespace app\api\validate;

use think\Validate;

class MoneyValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'	=>	['规则1','规则2'...]
     *
     * @var array
     */	
	protected $rule = [
	    'amount'    =>  ['require','egt:0'],
	    'code'  => ['require','number'],
	    'address'  => ['require'],
        'dealPwd'  => ['require','number','length:6'],
        'coinName'  => ['require'],
    ];
    
    /**
     * 定义错误信息
     * 格式：'字段名.规则名'	=>	'错误信息'
     *
     * @var array
     */	
    protected $message = [
        'amount.require'    =>  'amount require',
//        'amount.number'    =>  'amount number',
        'amount.egt'    =>  'amount egt',
        'code.require'    =>  'code require',
        'address.require'    =>  'address require',
        'dealPwd.require'    =>  'dealPwd require',
        'dealPwd.number'    =>  'dealPwd number',
        'dealPwd.length'    =>  'dealPwd length',
        'coinName.require'    =>  'coinName require',
    ];

    //场景验证
    protected $scene = [
        //兑换
        'exchange'  =>  ['amount','code'],
        //提现
        'applyWithdraw'  =>  ['amount','code','address','dealPwd','coinName'],
    ];
}
